﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'proc_cm_ListActiveSermonSeries')
BEGIN
    PRINT 'Dropping Procedure proc_cm_ListActiveSermonSeries'
    DROP  Procedure  proc_cm_ListActiveSermonSeries
END
GO

PRINT 'Creating Procedure proc_cm_ListActiveSermonSeries'
GO

CREATE PROCEDURE [dbo].[proc_cm_ListActiveSermonSeries]
AS
BEGIN
	SET NOCOUNT ON

	SELECT 
		ss.[sermon_series_id]
		,ss.[series_nm]
		,ss.[series_image_url]
		,ss.[detail_txt]
	FROM 
		[dbo].[tbl_sermon_series] ss (NOLOCK)
		INNER JOIN [dbo].[tbl_sermon] s (NOLOCK) ON ss.sermon_series_id = s.sermon_series_id
	GROUP BY
		ss.[sermon_series_id]
		,ss.[series_nm]
		,ss.[series_image_url]
		,ss.[detail_txt]
END
GO

GRANT EXEC ON dbo.proc_cm_ListActiveSermonSeries TO PUBLIC
GO
